package com.atguigu.gmall.feign.cart;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.cart.CartInfo;
import com.atguigu.gmall.model.product.SkuInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/api/cart")
@FeignClient("service-cart")
public interface CartFeignClient {

    @GetMapping("/addToCart")
    CartInfo addToCart(@RequestParam("skuId") Long skuId,
                      @RequestParam("skuNum") Integer skuNum);

    @GetMapping("/cartListChecked")
    List<CartInfo> cartInfoListCheck();

    /**
     * deleteSku?skuIds=1&skuIds=2&skuIds=3
     * 基本类型转不了json
     * {key: value}
     *
     *
     * json的数据类型：
     *  {key:value}
     *  [{},{}]
     *  [1,2,3]
     * 有key,value才能转json
     * Person
     * @param skuIds
     * @return
     */
    @DeleteMapping("/deleteSku")
    Result deleteSkuFromCart(@RequestBody List<Long> skuIds);
}